var devCode;
// var devName;
// var workshopId;
$(function () {
    devCode = getQueryString("devCode")
    // devName = getQueryString("devName")
    // workshopId = getQueryString("workshopId")
})

var vm = new Vue({
    el: '#rrapp',
    data: {
        showList: true,
        title: null,
        deviceInfoList: [],
        follow8dRecord: {
            remark: '',
            relCloseDate: '',
            closeDate: '',
            personLia: '',
            precaution: '',
            faultDescr: '',
            faultAppear: '',
            happenDate: '',
            workId: '',
            proLineId: '',
            workshopId: '',
            status: '',
            devId: '',
            devName: '',
            devCode: '',
            workName: '',
            workNo: '',
            proLineName: '',
            workshopName: '',
            id: '',
            updateUser: '',
            updateDate: '',
            createUser: '',
            createDate: '',
            recheckStatus: '',
            recheckTime: '',
            recheckUser: '',
            reviewStatus: '',
            reviewTime: '',
            reviewer: '',
            file8d: '',
            delFlag: '',
        },
        ruleValidate: {
            faultAppear: [{required: true, message: '故障现象不能为空!', trigger: 'blur'}],
            faultDescr: [{required: true, message: '问题描述不能为空!', trigger: 'blur'}],
        },
        q: {
            name: ''
        },
        picUrl: ''

    },
    methods: {
        query: function () {
            vm.reload();
        },
        handleBeforeUpload: function() {
            this.$refs.uploadFile.clearFiles()
            this.$Loading.start();
        },
        handleFormatError: function (file) {
            this.$Notice.warning({
                title: '文件格式不正确',
                desc: '文件 ' + file.name + ' 格式不正确，请上传格式正确的图片。'
            });
        },
        handleMaxSize: function (file) {
            this.$Notice.warning({
                title: '超出文件大小限制',
                desc: '文件 ' + file.name + ' 太大，不能超过 2M。'
            });
        },
        handleSuccess: function (res, file) {
            this.$Loading.finish();
            iview.Message.success('文件上传成功');
            vm.follow8dRecord.file8d = file.response.url;
            var url = vm.follow8dRecord.file8d;
            if (url) vm.picUrl = url.substring((url.lastIndexOf("\/") + 1), url.length);
        },
        eyeFile: function (url) {
            if (url) {
                window.open(url);
            } else {
                alert('还未上传文件');
            }
        }
    }

});
getDateform = function () {
    // vm.follow8dRecord.devName = devName;
    vm.follow8dRecord.devCode = devCode;
    // vm.follow8dRecord.workId = workshopId;
    return vm.follow8dRecord;
}
